<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script language=javascript src="dialog.js"></script>

<script language=javascript>
document.write ("<link href='../language/" + AvailableLangs["Active"] + ".css' type='text/css' rel='stylesheet'>");
document.write ("<link href='dialog.css' type='text/css' rel='stylesheet'>");

var sAction = "INSERT";
var sTitle = lang["DlgComInsert"];

var oControl;
var oSeletion;
var sRangeType;

var sUrl = "http://";
var sScrolling = "";
var sFrameBorder = "0";
var sMarginHeight = "0";
var sMarginWidth = "0";
var sWidth = "500";
var sHeight = "400";

oSelection = dialogArguments.eWebEditor.document.selection.createRange();
sRangeType = dialogArguments.eWebEditor.document.selection.type;

if (sRangeType == "Control") {
	if (oSelection.item(0).tagName == "IFRAME"){
		sAction = "MODI";
		sTitle = lang["DlgComModify"];
		oControl = oSelection.item(0);
		sUrl = oControl.src;
		sScrolling = oControl.scrolling;
		sFrameBorder = oControl.frameBorder;
		sMarginHeight = oControl.marginHeight;
		sMarginWidth = oControl.marginWidth;
		sWidth = oControl.width;
		sHeight = oControl.height;
	}
}


document.write("<title>" + lang["DlgIframe"] + "(" + sTitle + ")</title>");

function InitDocument(){
	AvailableLangs.TranslatePage(document);

	SearchSelectValue(d_scrolling, sScrolling.toLowerCase());

	d_url.value = sUrl;
	d_frameborder.value = sFrameBorder;
	d_marginheight.value = sMarginHeight;
	d_marginwidth.value = sMarginWidth;
	d_width.value = sWidth;
	d_height.value = sHeight;

	adjustDialog();
}

function ok(){
	sScrolling = d_scrolling.options[d_scrolling.selectedIndex].value;

	sUrl = d_url.value;
	if (!IsURL(sUrl)){
		BaseAlert(d_url, "��Ч����ҳ��ַ��");
		return;
	}

	d_frameborder.value = ToInt(d_frameborder.value);
	d_marginheight.value = ToInt(d_marginheight.value);
	d_marginwidth.value = ToInt(d_marginwidth.value);
	sFrameBorder = d_frameborder.value;
	sMarginHeight = d_marginheight.value;
	sMarginWidth = d_marginwidth.value;

	var sWidth = "";
	if (!MoreThanOne(d_width,'��Ч��֡��ȣ�')) return;
	sWidth = d_width.value;
	var sHeight = "";
	if (!MoreThanOne(d_height,'��Ч��֡�߶ȣ�')) return;
	sHeight = d_height.value;

	if (sAction == "MODI") {
		oControl.src = sUrl;
		oControl.scrolling = sScrolling;
		oControl.frameBorder = sFrameBorder;
		oControl.marginHeight = sMarginHeight;
		oControl.marginWidth = sMarginWidth;
		oControl.width = sWidth;
		oControl.height = sHeight;
	}else{
		dialogArguments.insertHTML("<iframe src='"+sUrl+"' scrolling='"+sScrolling+"' frameborder='"+sFrameBorder+"' marginheight='"+sMarginHeight+"' marginwidth='"+sMarginWidth+"' width='"+sWidth+"' height='"+sHeight+"'></iframe>");
	}

	window.returnValue = null;
	window.close();
}


function MoreThanOne(obj, sErr){
	var b=false;
	if (obj.value!=""){
		obj.value=parseFloat(obj.value);
		if (obj.value!="0"){
			b=true;
		}
	}
	if (b==false){
		BaseAlert(obj,sErr);
		return false;
	}
	return true;
}

</script>

</HEAD>

<body onload="InitDocument()">
	<table border=0 cellpadding=0 cellspacing=5 id=tabDialogSize>
		<tr>
			<td>


				<table border=0 cellpadding=0 cellspacing=0 align=center>
					<tr>
						<td>
							<fieldset>
								<legend>
									<span lang=DlgIframeProperty></span>
								</legend>
								<table border=0 cellpadding=5 cellspacing=0 width="100%">
									<tr>
										<td>

											<table border=0 cellpadding=0 cellspacing=2 width="100%">
												<tr>
													<td noWrap width="20%"><span lang=DlgIframeUrl></span>:</td>
													<td noWrap width="80%" colspan=4><input type=text
														id=d_url size=10 value="" style="width: 100%"></td>
												</tr>
												<tr>
													<td noWrap width="20%"><span lang=DlgIframeScroll></span>:</td>
													<td noWrap width="29%"><select id=d_scrolling size=1
														style="width: 80px">
															<option value='' lang=DlgComDefault></option>
															<option value='yes' lang=DlgIframeYes></option>
															<option value='no' lang=DlgIframeNo></option>
													</select></td>
													<td width="2%">&nbsp;</td>
													<td noWrap width="20%"><span lang=DlgIframeBorder></span>:</td>
													<td noWrap width="29%"><input style="width: 80px"
														id=d_frameborder size=10 maxlength=2 value=""
														ONKEYPRESS="event.returnValue=IsDigit();"></td>
												</tr>
												<tr>
													<td noWrap width="20%"><span
														lang=DlgIframeMarginHeight></span>:</td>
													<td noWrap width="29%"><input style="width: 80px"
														id=d_marginheight size=10 maxlength=2 value=""
														ONKEYPRESS="event.returnValue=IsDigit();"></td>
													<td width="2%">&nbsp;</td>
													<td noWrap width="20%"><span lang=DlgIframeMarginWidth></span>:</td>
													<td noWrap width="29%"><input style="width: 80px"
														id=d_marginwidth size=10 maxlength=2 value=""
														ONKEYPRESS="event.returnValue=IsDigit();"></td>
												</tr>
												<tr>
													<td noWrap width="20%"><span lang=DlgIframeWidth></span>:</td>
													<td noWrap width="29%"><input style="width: 80px"
														id=d_width size=10 maxlength=4 value=""
														ONKEYPRESS="event.returnValue=IsDigit();"></td>
													<td width="2%">&nbsp;</td>
													<td noWrap width="20%"><span lang=DlgIframeHeight></span>:</td>
													<td noWrap width="29%"><input style="width: 80px"
														id=d_height size=10 maxlength=4 value=""
														ONKEYPRESS="event.returnValue=IsDigit();"></td>
												</tr>
											</table>

										</td>
									</tr>
								</table>
							</fieldset>
						</td>
					</tr>
					<tr>
						<td height=5></td>
					</tr>
					<tr>
						<td noWrap align=right><input type=submit value='' id=Ok
							onclick="ok()" lang=DlgBtnOK>&nbsp;&nbsp;<input
							type=button value='' onclick="window.close();" lang=DlgBtnCancel></td>
					</tr>
				</table>


			</td>
		</tr>
	</table>
</BODY>
</HTML>
